package com.kemai.designmode.ui

import android.os.Bundle
import com.kemai.common.adapter.ItemClickListener
import com.kemai.common.ui.BaseActivity
import com.kemai.designmode.R
//设计模式
class DesignModeActivity : BaseActivity(), ItemClickListener {
    private val studyContent = arrayOf("静态工厂模式","工厂方法模式","抽象工厂模式","建造者工厂模式","单例模式","适配器模式","桥接模式","装饰器模式","代理模式","组合模式","外观模式","模板方法模式","策略模式","责任链模式","观察者模式","命令模式","访问者模式")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_common_content)
        setTiTle("设计模式")
        setAdapterContent(studyContent,DesignModeActivity@this,DesignModeActivity@this)
    }

    override fun itemClick(position: Int) {

        when(position){
            0->{//静态工厂模式
                showPage(DesignModeActivity@this,StaticFactoryActivity::class.java)
            }
            1->{//工厂方法模式
                showPage(DesignModeActivity@this,FactoryMethodActivity::class.java)
            }
            2->{//抽象方法模式
                showPage(DesignModeActivity@this,AbstractFactoryActivity::class.java)
            }
            3->{//建造者工厂模式
                showPage(DesignModeActivity@this,BuildModeActivity::class.java)
            }
            4->{//单例模式
                showPage(DesignModeActivity@this,SingleTonActivity::class.java)
            }
            5->{//适配器模式
                showPage(DesignModeActivity@this,AdapterActivity::class.java)
            }
            6->{//桥接模式
                showPage(DesignModeActivity@this,BridgeActivity::class.java)
            }
            7->{//装饰器模式
                showPage(DesignModeActivity@this,DecoratorActivity::class.java)
            }
            8->{//代理模式
                showPage(DesignModeActivity@this,ProxyActivity::class.java)
            }
            9->{//组合代理
                showPage(DesignModeActivity@this,CompositeActivity::class.java)
            }
            10->{//外观模式
                showPage(DesignModeActivity@this,FacadeActivity::class.java)
            }
            11->{//模板方法模式
                showPage(DesignModeActivity@this,TemplateActivity::class.java)
            }
            12->{//策略模式
                showPage(DesignModeActivity@this,StrategyActivity::class.java)
            }
            13->{//责任链模式
                showPage(DesignModeActivity@this,ChainActivity::class.java)
            }
            14->{//观察者模式
                showPage(DesignModeActivity@this,ObserverActivity::class.java)
            }
            15->{//命令模式
                showPage(DesignModeActivity@this,CommandActivity::class.java)
            }
            16->{//访问者模式
                showPage(DesignModeActivity@this,VisitActivity::class.java)
            }
        }

    }

}